package com.ssy.lingxi.transaction.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import java.io.Serializable;

/**
 * 商品对应的区域表
 * @author jw.chen
 * @version 2.0.0
 * @date 2020/7/13
 */
@Getter
@Setter
@Entity
@Table(schema = "public", name = "trade_inquiry_product_commodity_area")
public class CommodityArea implements Serializable {
    private static final long serialVersionUID = -396825032535009269L;

    /**
     * 主键id
     */
    @Id
    @GeneratedValue(strategy= GenerationType.SEQUENCE, generator="inquiry_product_commodity_area_seq")
    @SequenceGenerator(sequenceName="trade_inquiry_product_commodity_area_seq", name="inquiry_product_commodity_area_seq",allocationSize = 1)
    private Long id;

    /**
     * 询价商品id
     */
    @JsonIgnore
    @ManyToOne(cascade = {CascadeType.PERSIST})
    @JoinColumn(name="inquiryProductId",referencedColumnName = "id")
    private InquiryProduct inquiryProduct;

    /**
     * 省级编码
     */
    @Column(columnDefinition = "varchar(10)", nullable = false)
    private String provinceCode;

    /**
     * 省级名称
     */
    @Column(columnDefinition = "varchar(20)", nullable = false)
    private String provinceName;

    /**
     * 是否不限制城市
     */
    @Column(columnDefinition = "boolean")
    private Boolean isAllCity = true;

    /**
     * 市级编码
     */
    @Column(columnDefinition = "varchar(10)")
    private String cityCode;

    /**
     * 市级名称
     */
    @Column(columnDefinition = "varchar(20)")
    private String cityName;

    /**
     * 是否不限制区域
     */
    @Column(columnDefinition = "boolean")
    private Boolean isAllRegion = true;

    /**
     * 区域编码
     */
    @Column(columnDefinition = "varchar(10)")
    private String regionCode;

    /**
     * 区域名称
     */
    @Column(columnDefinition = "varchar(20)")
    private String regionName;
}
